//SamXIAO
#include <bits/stdc++.h>
using namespace std;
#define PI 3.1415926
#define   SQUARE(x) ((x)*(x))
//double SQUARE(double x) { return x*x;}

int f[10086];

void w1()
{
	int a, b, c,  n, L, m, ans = 0;
	//scanf("%d", &n);
	int cnt = 0;
	for(int i=1; i<=7; i++){
		scanf("%d%d", &a, &b);
		if(a + b > 8){
			if(cnt < a + b){
				cnt = a + b;
				ans = i;
			}
		}
  }

	printf("%d", ans  );
}

int main()
{
	w1();
  return 0;
}
